package com.itheima.A08Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Test2 {
    public static void main(String[] args) {
        //班级里有N个学生
        //要求：
        //70%的概率随机到男生
        //30%的概率随机到女生
        //"范闲"，"范建"，"范统"，"杜子腾"，"宋合泛"，"侯笼藤"，"朱益群"，"朱穆朗玛峰"，
        //"杜琦燕"，"袁明媛"，"李晴"，"田蜜蜜"
        //

        //创建男女生集合
        ArrayList<String> boys = new ArrayList<>();
        Collections.addAll(boys,"范闲","范建","范统","杜子腾","宋合泛","侯笼藤","朱益群","朱穆朗玛峰");
        ArrayList<String> girls = new ArrayList<>();
        Collections.addAll(girls,"杜琦燕","袁明媛","李晴","田蜜蜜");

        int[] arr ={1,1,1,1,1,1,1,0,0,0};
        //获取随机数(用于获取概率的)
        Random r = new Random();
        int i = r.nextInt(arr.length);//0-9

        //获取随机数(用于获取男女生的)
        if(arr[i]==1){
            int b = r.nextInt(boys.size());//0-7
            System.out.println(boys.get(b));
        }else{
            int g = r.nextInt(girls.size());//0-3
            System.out.println(girls.get(g));
        }

    }
}
